#region Usings

using System.Xml.XPath;

#endregion

namespace Kazkommertsbank.Framework.Model.Pay
{
    public class PaymentCustomer
    {
        private readonly string _xml;

        public PaymentCustomer(XPathNavigator nav)
        {
            _xml = nav.OuterXml;
            Name = nav.GetAttribute("name", "");
            Mail = nav.GetAttribute("mail", "");
            Phone = nav.GetAttribute("phone", "");
            XPathNavigator navigator = nav.SelectSingleNode("customer");
            if(navigator != null)
                Merchant = new PaymentMerchant(navigator);
        }

        public string Name { get; private set; }
        public string Mail { get; private set; }
        public string Phone { get; private set; }
        public PaymentMerchant Merchant { get; private set; }

        public string ToXmlString()
        {
            return _xml;
        }
    }
}